package org.javaboy.demo;

import org.javaboy.demo.service.UserService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * public class UserServiceProxy extends UserService{
 *     UserService us = new UserService();
 *     public void transferMoney(String from, String to, Double money) {
             Object proceed = null;
             TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
             try {
             proceed = us.transferMoney(from,to,money);
             transactionManager.commit(status);
             } catch (Throwable e) {
             transactionManager.rollback(status);
             throw new RuntimeException(e);
             }
             return proceed;
 *     }
 * }
 */
public class Demo01 {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(JavaConfig.class);
        UserService us = ctx.getBean(UserService.class);
        us.transferMoney("zhangsan", "lisi", 100.0);
    }
}
